<template>
    <!-- 活动管理参加人弹窗 -->
    <active-select-user :count="count" :activeInfo="activeInfo"
      @dataChange="dataChange"></active-select-user>
  </template>
  
  <script>
  import ActiveSelectUser from '@xiaoe/xe-edu-poplar/lib/ActiveSelectUser/index.js'
  export default {
    props: {
      businessConf: {
        type: Object,
        default: () => ({})
      },
      goodsInfo: {
        type: Object,
        default: () => ({})
      },
      formData: {
        type: Object,
        default: () => ({})
      }
    },
    components: {
      ActiveSelectUser
    },
    data() {
      return {
        errMsg: null
      };
    },
    computed: {
      //活动管理报名用户业务测数据
      activeInfo() {
        return this.businessConf[this.goodsInfo.spu_type] || {};
      },
      count() {
        let attr_value = this.goodsInfo.attr_value;
        if (attr_value && attr_value[0]) {
          return Number(this.formData.count * attr_value[0].extend.ticket_scale);
        }
        return Number(this.formData.count);
      },
    },
    methods: {
      dataChange(data) {
        console.log(data)
        this.errMsg = data.errMsg;
        this.$emit('change', data.payParams);
      },
      validate() {
        return this.errMsg ? Promise.reject(this.errMsg) : Promise.resolve();
      }
    },
  };
  </script>